//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Media;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    //\\change name
    public class PresetColor : ColorBase
    {
        internal PresetColor()
        {
            
        }

        public PresetColor(PresetColorValue value)
        {
            Value = value;
        }
        
        public PresetColorValue Value
        {
            get; private set;
        }


        protected override Color ResolveRawColor(ColorScheme colorScheme)
        {
            switch (Value)
            {
                case PresetColorValue.AliceBlue:
                    return Colors.AliceBlue;
                case PresetColorValue.AntiqueWhite:
                    return Colors.AntiqueWhite;
                case PresetColorValue.Aqua:
                    return Colors.Aqua;
                case PresetColorValue.Aquamarine:
                    return Colors.Aquamarine;
                case PresetColorValue.Azure:
                    return Colors.Azure;
                case PresetColorValue.Beige:
                    return Colors.Beige;
                case PresetColorValue.Bisque:
                    return Colors.Bisque;
                case PresetColorValue.Black:
                    return Colors.Black;
                case PresetColorValue.BlanchedAlmond:
                    return Colors.BlanchedAlmond;
                case PresetColorValue.Blue:
                    return Colors.Blue;
                case PresetColorValue.BlueViolet:
                    return Colors.BlueViolet;
                case PresetColorValue.Brown:
                    return Colors.Brown;
                case PresetColorValue.BurlyWood:
                    return Colors.BurlyWood;
                case PresetColorValue.CadetBlue:
                    return Colors.CadetBlue;
                case PresetColorValue.Chartreuse:
                    return Colors.Chartreuse;
                case PresetColorValue.Chocolate:
                    return Colors.Chocolate;
                case PresetColorValue.Coral:
                    return Colors.Coral;
                case PresetColorValue.CornFlowerBlue:
                    return Color.FromRgb(100, 149, 237);
                case PresetColorValue.CornSilk:
                    return Color.FromRgb(255, 248, 220);
                case PresetColorValue.Crimson:
                    return Colors.Crimson;
                case PresetColorValue.Cyan:
                    return Colors.Cyan;
                case PresetColorValue.DarkBlue:
                    return Colors.DarkBlue;
                case PresetColorValue.DarkCyan:
                    return Colors.DarkCyan;
                case PresetColorValue.DarkGoldenrod:
                    return Colors.DarkGoldenrod;
                case PresetColorValue.DarkGray:
                    return Colors.DarkGray;
                case PresetColorValue.DarkGreen:
                    return Colors.DarkGreen;
                case PresetColorValue.DarkKhaki:
                    return Colors.DarkKhaki;
                case PresetColorValue.DarkMagenta:
                    return Colors.DarkMagenta;
                case PresetColorValue.DarkOliveGreen:
                    return Colors.DarkOliveGreen;
                case PresetColorValue.DarkOrange:
                    return Colors.DarkOrange;
                case PresetColorValue.DarkOrchid:
                    return Colors.DarkOrchid;
                case PresetColorValue.DarkRed:
                    return Colors.DarkRed;
                case PresetColorValue.DarkSalmon:
                    return Colors.DarkSalmon;
                case PresetColorValue.DarkSeaGreen:
                    return Colors.DarkSeaGreen;
                case PresetColorValue.DarkSlateBlue:
                    return Colors.DarkSlateBlue;
                case PresetColorValue.DarkSlateGray:
                    return Colors.DarkSlateGray;
                case PresetColorValue.DarkTurquoise:
                    return Colors.DarkTurquoise;
                case PresetColorValue.DarkViolet:
                    return Colors.DarkViolet;
                case PresetColorValue.DeepPink:
                    return Colors.DeepPink;
                case PresetColorValue.DeepSkyBlue:
                    return Colors.DeepSkyBlue;
                case PresetColorValue.DimGray:
                    return Colors.DimGray;
                case PresetColorValue.DodgerBlue:
                    return Colors.DodgerBlue;
                case PresetColorValue.Firebrick:
                    return Colors.Firebrick;
                case PresetColorValue.FloralWhite:
                    return Colors.FloralWhite;
                case PresetColorValue.ForestGreen:
                    return Colors.ForestGreen;
                case PresetColorValue.Fuchsia:
                    return Colors.Fuchsia;
                case PresetColorValue.Gainsboro:
                    return Colors.Gainsboro;
                case PresetColorValue.GhostWhite:
                    return Colors.GhostWhite;
                case PresetColorValue.Gold:
                    return Colors.Gold;
                case PresetColorValue.Goldenrod:
                    return Colors.Goldenrod;
                case PresetColorValue.Gray:
                    return Colors.Gray;
                case PresetColorValue.Green:
                    return Colors.Green;
                case PresetColorValue.GreenYellow:
                    return Colors.GreenYellow;
                case PresetColorValue.Honeydew:
                    return Colors.Honeydew;
                case PresetColorValue.HotPink:
                    return Colors.HotPink;
                case PresetColorValue.IndianRed:
                    return Colors.IndianRed;
                case PresetColorValue.Indigo:
                    return Colors.Indigo;
                case PresetColorValue.ivory:
                    return Colors.Ivory;
                case PresetColorValue.khaki:
                    return Colors.Khaki;
                case PresetColorValue.Lavender:
                    return Colors.Lavender;
                case PresetColorValue.LavenderBlush:
                    return Colors.LavenderBlush;
                case PresetColorValue.LawnGreen:
                    return Colors.LawnGreen;
                case PresetColorValue.LemonChiffon:
                    return Colors.LemonChiffon;
                case PresetColorValue.LightBlue:
                    return Colors.LightBlue;
                case PresetColorValue.LightCoral:
                    return Colors.LightCoral;
                case PresetColorValue.LightCyan:
                    return Colors.LightCyan;
                case PresetColorValue.LightGoldenrodYellow:
                    return Colors.LightGoldenrodYellow;
                case PresetColorValue.LightGray:
                    return Colors.LightGray;
                case PresetColorValue.LightGreen:
                    return Colors.LightGreen;
                case PresetColorValue.LightPink:
                    return Colors.LightPink;
                case PresetColorValue.LightSalmon:
                    return Colors.LightSalmon;
                case PresetColorValue.LightSeaGreen:
                    return Colors.LightSeaGreen;
                case PresetColorValue.LightSkyBlue:
                    return Colors.LightSkyBlue;
                case PresetColorValue.LightSlateGray:
                    return Colors.LightSlateGray;
                case PresetColorValue.LightSteelBlue:
                    return Colors.LightSteelBlue;
                case PresetColorValue.LightYellow:
                    return Colors.LightYellow;
                case PresetColorValue.Lime:
                    return Colors.Lime;
                case PresetColorValue.LimeGreen:
                    return Colors.LimeGreen;
                case PresetColorValue.Linen:
                    return Colors.Linen;
                case PresetColorValue.Magenta:
                    return Colors.Magenta;
                case PresetColorValue.Maroon:
                    return Colors.Maroon;
                case PresetColorValue.MediumAquamarine:
                    return Colors.MediumAquamarine;
                case PresetColorValue.MediumBlue:
                    return Colors.MediumBlue;
                case PresetColorValue.MediumOrchid:
                    return Colors.MediumOrchid;
                case PresetColorValue.MediumPurple:
                    return Colors.MediumPurple;
                case PresetColorValue.MediumSeaGreen:
                    return Colors.MediumSeaGreen;
                case PresetColorValue.MediumSlateBlue:
                    return Colors.MediumSlateBlue;
                case PresetColorValue.MediumSpringGreen:
                    return Colors.MediumSpringGreen;
                case PresetColorValue.MediumTurquoise:
                    return Colors.MediumTurquoise;
                case PresetColorValue.MediumVioletRed:
                    return Colors.MediumVioletRed;
                case PresetColorValue.MidnightBlue:
                    return Color.FromRgb(25, 25, 112);
                case PresetColorValue.MintCream:
                    return Colors.MintCream;
                case PresetColorValue.MistyRose:
                    return Colors.MistyRose;
                case PresetColorValue.Moccasin:
                    return Colors.Moccasin;
                case PresetColorValue.NavajoWhite:
                    return Colors.NavajoWhite;
                case PresetColorValue.Navy:
                    return Colors.Navy;
                case PresetColorValue.OldLace:
                    return Colors.OldLace;
                case PresetColorValue.Olive:
                    return Colors.Olive;
                case PresetColorValue.OliveDrab:
                    return Colors.OliveDrab;
                case PresetColorValue.Orange:
                    return Colors.Orange;
                case PresetColorValue.OrangeRed:
                    return Colors.OrangeRed;
                case PresetColorValue.Orchid:
                    return Colors.Orchid;
                case PresetColorValue.PaleGoldenrod:
                    return Colors.PaleGoldenrod;
                case PresetColorValue.PaleGreen:
                    return Colors.PaleGreen;
                case PresetColorValue.PaleTurquoise:
                    return Colors.PaleTurquoise;
                case PresetColorValue.PaleVioletRed:
                    return Colors.PaleVioletRed;
                case PresetColorValue.PapayaWhip:
                    return Colors.PapayaWhip;
                case PresetColorValue.PeachPuff:
                    return Colors.PeachPuff;
                case PresetColorValue.Peru:
                    return Colors.Peru;
                case PresetColorValue.Pink:
                    return Colors.Pink;
                case PresetColorValue.Plum:
                    return Colors.Plum;
                case PresetColorValue.PowderBlue:
                    return Colors.PowderBlue;
                case PresetColorValue.Purple:
                    return Colors.Purple;
                case PresetColorValue.Red:
                    return Colors.Red;
                case PresetColorValue.RosyBrown:
                    return Colors.RosyBrown;
                case PresetColorValue.RoyalBlue:
                    return Colors.RoyalBlue;
                case PresetColorValue.SaddleBrown:
                    return Colors.SaddleBrown;
                case PresetColorValue.Salmon:
                    return Colors.Salmon;
                case PresetColorValue.SandyBrown:
                    return Colors.SandyBrown;
                case PresetColorValue.SeaGreen:
                    return Colors.SeaGreen;
                case PresetColorValue.SeaShell:
                    return Colors.SeaShell;
                case PresetColorValue.Sienna:
                    return Colors.Sienna;
                case PresetColorValue.Silver:
                    return Colors.Silver;
                case PresetColorValue.SkyBlue:
                    return Colors.SkyBlue;
                case PresetColorValue.SlateBlue:
                    return Colors.SlateBlue;
                case PresetColorValue.SlateGray:
                    return Colors.SlateGray;
                case PresetColorValue.Snow:
                    return Colors.Snow;
                case PresetColorValue.SpringGreen:
                    return Colors.SpringGreen;
                case PresetColorValue.SteelBlue:
                    return Colors.SteelBlue;
                case PresetColorValue.Tan:
                    return Colors.Tan;
                case PresetColorValue.Teal:
                    return Colors.Teal;
                case PresetColorValue.Thistle:
                    return Colors.Thistle;
                case PresetColorValue.Tomato:
                    return Colors.Tomato;
                case PresetColorValue.Transparent:
                    return Colors.Transparent;
                case PresetColorValue.Turquoise:
                    return Colors.Turquoise;
                case PresetColorValue.Violet:
                    return Colors.Violet;
                case PresetColorValue.Wheat:
                    return Colors.Wheat;
                case PresetColorValue.White:
                    return Colors.White;
                case PresetColorValue.WhiteSmoke:
                    return Colors.WhiteSmoke;
                case PresetColorValue.Yellow:
                    return Colors.Yellow;
                case PresetColorValue.YellowGreen:
                    return Colors.YellowGreen;
                default:
                    throw new NotSupportedException();
            }
        }

        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("prstClr"))
            {
                Value = c.GetEnum<PresetColorValue>("val");
                ReadTransforms(c);
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("prstClr"))
            {
                c.SetEnum("val", Value);
                WriteTransforms(c);
            }
        }
    }
}